package Viewer;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;

public class PopUpMenu extends JPopupMenu implements ActionListener{

	
	private Viewer viewer;
	
	public PopUpMenu(Viewer viewer) {
		this.viewer = viewer;
		
		
		JMenuItem show = new JMenuItem("show");
		this.add(show);
		show.addActionListener(this);
		show.setActionCommand("show");
		setVisible(true);
		
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		if(e.getActionCommand() == "show"){
			if(this.isVisible())
				this.setVisible(false);
			else
				this.setVisible(true);
			
		}
	}
	
}
